<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h3  id='h3'></h3>
    <input type="text" id='input'  />

    <script>
        let obj = {
            text:[]
        };
        let newObj = JSON.parse(JSON.stringify(obj));
        Object.defineProperty(obj,'text',{
            get(){
                return newObj.text[0];
            },
            set(val){
                newObj.text[0] = val;
                observer();
            }
        });
        function observer(){
            document.getElementById('h3').innerText = obj.text[0];
            document.getElementById('input').value = obj.text[0];
        };
        document.getElementById('input').oninput = function(e) {
            obj.text[0] = e.target.value;
        }
    </script>
</body>
</html>